# Contributor: Hannes Braun <hannes@hannesbraun.net>
# Maintainer: Hannes Braun <hannes@hannesbraun.net>
pkgname=sourcegit
pkgver=8.33
pkgrel=0
pkgdesc="Open-source & Free Git GUI Client"
url="https://sourcegit-scm.github.io/"
arch="x86_64 aarch64" # blocked by dotnet's native AOT compilation
license="MIT"
makedepends="dotnet8-sdk zlib-dev"
source="https://github.com/sourcegit-scm/sourcegit/archive/v$pkgver/sourcegit-$pkgver.tar.gz"
options="!check" # no test suite

build() {
	dotnet publish src/SourceGit.csproj \
		--no-self-contained \
		--use-current-runtime \
		--configuration Release \
		--output publish
}

package() {
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

	mkdir -p "$pkgdir"/usr/lib "$pkgdir/usr/bin"
	rm publish/*.dbg
	cp -a publish "$pkgdir"/usr/lib/sourcegit
	ln -s ../lib/sourcegit/SourceGit "$pkgdir"/usr/bin/sourcegit

	sed -i 's|^Exec=.*$|Exec=/usr/bin/sourcegit|g' \
		build/resources/_common/applications/sourcegit.desktop
	sed -i 's|^Icon=.*$|Icon=/usr/share/icons/hicolor/256x256/apps/sourcegit.png|g' \
		build/resources/_common/applications/sourcegit.desktop
	install -Dm644 build/resources/_common/applications/sourcegit.desktop \
		"$pkgdir"/usr/share/applications/sourcegit.desktop
	install -Dm644 build/resources/_common/icons/sourcegit.png \
		"$pkgdir"/usr/share/icons/hicolor/256x256/apps/sourcegit.png
}

sha512sums="
f73ee46bd0721f529a9d31fb9297a81628b80c20409348e869767cceed8e872be6e58c023c885756d4287f043981dd922ce0d1ffb72aea21adfb33fb346d43b4  sourcegit-8.33.tar.gz
"
